﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using static System.Console;

namespace ConsoleApplication3
{
    class Program
    {
        static void Prime(int n)
        {
            int[] a=new int [n];
            if (n <3)
            {
                WriteLine("请重新输入！！！");
                return;
            }
            for (int i = 0; i < n; i++) a[i] = i;
            
            for (int x=2;x< n; x++)
            {
                for(int i = 2; i < n; i++)
                {
                    if (a[i] == 0) continue;
                    else if (a[i] % x == 0&&a[i]!=x) a[i] = 0;
                   
                }
            }
            for (int i = 2; i < n; i++)
            {
                if (a[i] != 0)
                    Write(a[i] + " ");
            }

        }


        static void Main(string[] args)
        {
            while (true)
            {
                Write("请输入你想要的数：");
                int n = Int32.Parse(ReadLine());
                Prime(n);
                WriteLine();
            } 
        }
    }
}
